#!/usr/bin/env sh
# Copyright (c) 2018 noamcore. All rights reserved.

ICMP='\x08\x00\x20\x86\x35\x4b\x00\xe0\xf7\x26\x3f\xe9\x08\x00\x45\x00\x00\x54\xaa\xfb\x40\x00\xfc\x01\xfa\x30\x8b\x85\xe9\x02\x8b\x85\xd9\x6e\x00\x00\x45\xda\x1e\x60\x00\x00\x33\x5e\x3a\xb8\x00\x00\x42\xac\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30\x31\x32\x33\x34\x35\x36\x37'

HOST=$1
shift

for PORT in $*; do
    (echo -n -e $ICMP > /dev/tcp/$HOST/$PORT) & >/dev/null 2>&1
    echo "Port $PORT knocked"
done

sleep 2 && echo Ready to go.

# vim: set ts=4 sw=4 noet:
